package org.ohuang

fun tryCatch(isLog: Boolean=true,method:()->Unit){
    try {
        method.invoke()
    }catch (e:Exception){
        if (isLog){
            e.printStackTrace()
        }
    }
}

fun tryCatch(isLog: String,method:()->Unit){
    try {
        method.invoke()
    }catch (e:Exception){
      println(isLog)
    }
}


fun tryCatch(method:()->Unit,catch:(Exception)->Unit){
    try {
        method.invoke()
    }catch (e:Exception){
         catch.invoke(e)
    }
}